<template>
    <Browser class="browser" :basic-info="basicInfo" :last-update-time="lastUpdateTime"></Browser>
    <LineChart ref="lineChart" @lastUpdateTime="handerTime"></LineChart>
    <PieChart></PieChart>
</template>

<script setup lang="ts">
import Browser from './components/Browse.vue';
import LineChart from './components/LineChart.vue';
import PieChart from './components/PieChart.vue';
import { cusStatBasicInfo } from '@/api/customerCenter';
import { ref, onMounted, reactive, nextTick } from 'vue';

const lineChart = ref();
const basicInfo = ref([]);
const lastUpdateTime = ref('');

// 客户统计基本信息
const getBasicInfo = () => {
    cusStatBasicInfo().then((data: any) => {
        basicInfo.value = data;
    });
};

const handerTime = (val: string) => {
    lastUpdateTime.value = val;
};

onMounted(() => {
    getBasicInfo();
});
</script>

<style lang="scss" scoped>
.layout {
    .search {
        margin: 16px 0;
    }

    .pie {
        margin-bottom: 16px;
    }

    .list {
        margin-top: 15px;
    }

    .updated {
        margin-top: 16px;

        span {
            padding: 0 5px;
            line-height: 20px;
            color: #ff6b00;
            font-size: 14px;
            margin-top: 13px;
            border-radius: 10px;
            border: 1px solid #ff6b00;
            text-align: center;
        }
    }

    .search_box {
        width: 100%;
        margin-bottom: 14px;
    }
}
</style>
